const app = new Vue({
  el: "#app",
  data: {
    prounds: [
      { id: 1, name: "电冰箱", price: "111", num: 1 },
      { id: 2, name: "电磁炉", price: "222", num: 12},
    ],
    total :0,
  },
  //事件监听
  watch:{
      prounds:{
          handler:function (val) {
              //初始值
              var count = 0;
              val.forEach(element => {
                  //循环赋值给count
                  count+= element.num*element.price;
                  this.total = count;
              });
          },
          deep:true
      }
  }
});